@extends('layout.admin')
@section('title','修改用户')
@section('content')
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" >
        <div class="col-md-12" id="content" >
            <div class="app_content_div" id="app_content_div_301Index">
                <h3>修改管理员</h3>
    <form class="form-horizontal">

        @csrf
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"><span style="color:red;"></span>姓名</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="name" name="name" value="{{$oUser->name}}">
            </div>
        </div>
        <div class="form-group">
            <label for="password" class="col-sm-2 control-label"><span style="color:red;">*</span>密码</label>
            <div class="col-sm-10">
                <input type="password" class="form-control" id="password" name="password">
            </div>
        </div>
        <div class="form-group">
            <label for="password_confirmation" class="col-sm-2 control-label"><span style="color:red;">*</span>确认密码</label>
            <div class="col-sm-10">
                <input type="password" class="form-control" id="password_confirmation" name="password_confirmation">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="button" onclick="edit()" class="btn btn-default">确定</button>
            </div>
        </div>
    </form>
            </div>
        </div>
    </div>
@endsection
<script>
    function edit(){
        let token='{{csrf_token()}}';
        let name=$('#name').val();

        let password=$('#password').val();
        let password_confirmation=$('#password_confirmation').val();
        //alert(name+email+password);
        $.post(
            '/adm/user_edit/{{$oUser->id}}',
            {'name':name,

                'password':password,
                'password_confirmation':password_confirmation,
                '_token':token},

            function(data){
                if(data.success){
                    alert('成功');
                    location.href='/adm/list'
                }else{
                    alert(data.msg)
                }
            }
            ,'json')
    }
</script>
